package com.wanmait.jd.controller;

import com.wanmait.jd.dao.UserinfoDAO;
import com.wanmait.jd.vo.Userinfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class UserController {
    @RequestMapping("showAllUser")
    public String showAllUser(HttpServletRequest request) {
        UserinfoDAO userinfoDAO = new UserinfoDAO();
        List<Userinfo> userinfoList = userinfoDAO.findAll();
        userinfoList.forEach(user-> System.out.println(user));
        request.setAttribute("userinfoList", userinfoList);
        return "S/showAllUser";
    }
}